package com.lagou.com.lagou.service;

import com.lagou.service.HelloService;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;
import org.springframework.beans.factory.annotation.Value;

/**
 * @author: 韩逊
 * @date: 2020-05-01 21:00
 * @Description:
 */

@Service
public class HelloServiceImpl implements HelloService {
    @Value("${spring.profiles.active}")
    private String profile;

    @Override
    public String hello() {
        String addr = RpcContext.getContext().getAttachment("addr");
        System.out.println(addr + '@' + profile);
        return String.format("Your IP is %s@%s", addr, profile);
    }
}
